package com.gitee.wsl.transform.validator.string.ext

import com.gitee.wsl.transform.validator.string.StringValidator
import com.gitee.wsl.transform.validator.string.then

fun StringValidator.minLength(minLength: Int) = then("min : $minLength") { it.length >= minLength }

fun StringValidator.maxLength(maxLength: Int) = then("max : $maxLength") { it.length >= maxLength }

fun StringValidator.length(length: Int) = then("length : $length") { it.length == length }

fun StringValidator.lengthInRange(range: IntRange) = then("range ont in : $range") { it.length in range }